<!DOCTYPE html>
<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout">

<head>
    <title th:text="${pageTitle}"></title>
    <div data-th-replace="layout/head-top"></div>
</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInLeft">
        <div data-th-replace="common/functionDepict"></div>
        <form id="saveSysUser">
            <input type="hidden" name="id" th:value="${sysUser['id']}" />
            <input type="hidden" name="userType" th:value="${sysUser['userType']}==null ? 1: ${sysUser['userType']}"/>
            <input type="hidden" name="userImg" th:value="${sysUser['imageJson']}"/>
            <div>
                <div class="row">
                    <div class="pt10">
                        <div class="col-sm-9">
                            <div class="ibox float-e-margins">
                                <div class="ibox-title">
                                    <h5>填写基本信息</h5>
                                </div>
                                <div class="ibox-content clearfix pt10">
                                    <div class="form-horizontal">
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label text-right"><i class="c-red">*</i> 登录账号</label>
                                            <div class="col-sm-8">
                                                <input class="form-control" type="text" name="account" th:readonly="${sysUser['username']}!=null" th:value="${sysUser['username']}">
                                                <span class="help-block m-b-none c-999">账号名称 限30个字符以内</span>
                                            </div>
                                        </div>
                                        <div class="hr-line-dashed"></div>
                                        <div th:if="${sysUser['id']}==null or  ${sysUser['id']} <= 0" class="form-group">
                                            <label class="col-sm-2 control-label text-right"><i class="c-red">*</i> 账号类型设置</label>
                                            <div class="col-sm-8">
                                                <div style="margin-top: 5px">
                                                    <div class="switch">
                                                        <div class="onoffswitch">
                                                            <input type="checkbox" th:checked="${sysUser['userType']} == 2" th:disabled="${sysUser['userType']} == 2" class="onoffswitch-checkbox" id="userType">
                                                            <label class="onoffswitch-label" for="userType">
                                                                <span class="onoffswitch-inner"></span>
                                                                <span class="onoffswitch-switch"></span>
                                                            </label>
                                                        </div>
                                                        <span>
                                                            <small class="fs12 c-red hide" id="checkOn">ON为体验账号，体验时间为7天。如需同步前台账号，务必填写手机号，其他字段可不填；</small>
                                                            <small class="fs12 c-red " id="checkOff">OFF为正式账号，所有字段必填。登录密码默认为123456</small>
                                                        </span>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div th:if="${sysUser['id']}==null or  ${sysUser['id']} <= 0" class="hr-line-dashed"></div>

                                        <div class="form-group">
                                            <label class="col-sm-2 control-label text-right"><i class="c-red" data-userType>*</i> 真实姓名</label>
                                            <div class="col-sm-8">
                                                <input class="form-control validate-data" type="text" name="ralName" th:value="${sysUser['ralName']}">
                                                <span class="help-block m-b-none c-999">真实姓名 限30个字符以内</span>
                                            </div>
                                        </div>
                                        <div class="hr-line-dashed"></div>

                                        <div class="form-group">
                                            <label class="col-sm-2 control-label text-right"><i class="c-red" data-userType>*</i> 联系手机号</label>
                                            <div class="col-sm-8">
                                                <input class="form-control validate-data" type="text" name="mobile" th:value="${sysUser['mobile']}">
                                                <span class="help-block m-b-none c-999">填写真实常用手机号</span>
                                            </div>
                                        </div>
                                        <div class="hr-line-dashed"></div>

                                        <div th:if="${sysUser['userType']}!=2" class="form-group" data-userType>
                                            <label class="col-sm-2 control-label text-right"><i class="c-red">*</i> 选择部门</label>
                                            <div class="col-sm-8">
                                                <input type="hidden" id="hiddenGroupId" name="groupId" th:value="${sysUser['groupId']}">
                                                <input type="hidden" id="hiddenGroupIds" name="groupIds" th:value="${sysUser['groupIds']}"/>
                                                <input class="form-control" type="text" autocomplete="off" id="group" th:value="${sysUser['sysGroup']}!=null?${sysUser['sysGroup']['groupName']}:''">
                                                <span class="help-block m-b-none c-999">点击选择系统用户所属部门</span>
                                            </div>
                                        </div>
                                        <div th:if="${sysUser['userType']}!=2"class="hr-line-dashed"></div>

                                        <div th:if="${sysUser['id']}==null or  ${sysUser['id']} <= 0" class="form-group" data-userType>
                                            <label class="col-sm-2 control-label text-right"><i class="c-red">*</i> 是否为讲师</label>
                                            <div class="col-sm-8">
                                                <div style="margin-top: 5px">
                                                    <div class="switch">
                                                        <div class="onoffswitch">
                                                            <input type="checkbox" class="onoffswitch-checkbox" id="teacherId" name="isTeacher">
                                                            <label class="onoffswitch-label" for="teacherId">
                                                                <span class="onoffswitch-inner"></span>
                                                                <span class="onoffswitch-switch"></span>
                                                            </label>
                                                        </div>
                                                        <span>
                                                            <small class="fs12 c-red">ON表示该系统用户同时为讲师</small>
                                                        </span>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div th:if="${sysUser['id']}==null or  ${sysUser['id']} <= 0" class="hr-line-dashed"></div>

                                        <div th:if="${sysUser['userType']}!=2" class="form-group" data-userType>
                                            <label class="col-sm-2 control-label text-right"><i class="c-red">*</i> 对应角色</label>
                                            <div class="col-sm-8">
                                                <div class="input-group">
                                                    <select data-placeholder="选择对应角色" class="chosen-select-no-search" multiple style="width: 350px" tabindex="-1" name="roleIds">
                                                        <option th:each="role : ${roleList}" th:value="${role['id']}" hassubinfo="true" th:selected="${sysUser['roleIds']}!=null and ${#strings.contains(sysUser['roleIds'],','+role['id']+',')}" th:text="${role['roleName']}"></option>
                                                    </select>
                                                </div>
                                                <span class="help-block m-b-none">按需选择账号拥有的角色</span>
                                            </div>
                                            <div class="col-sm-2 mt10"><a href="javascript:;" id="newRole"><i class="fa fa-plus"></i> 新建角色</a></div>
                                        </div>
                                        <div th:if="${sysUser['userType']}!=2" class="hr-line-dashed"></div>

                                        <div th:if="${sysUser['id']}==null or  ${sysUser['id']} <= 0" class="form-group">
                                            <label class="col-sm-2 control-label text-right"><i class="c-red">*</i> 是否同步前台账号</label>
                                            <div class="col-sm-8">
                                                <div style="margin-top: 5px">
                                                    <div class="switch">
                                                        <div class="onoffswitch">
                                                            <input type="checkbox" checked class="onoffswitch-checkbox" id="sync" name="isSync">
                                                            <label class="onoffswitch-label" for="sync">
                                                                <span class="onoffswitch-inner"></span>
                                                                <span class="onoffswitch-switch"></span>
                                                            </label>
                                                        </div>
                                                        <span>
                                                            <small class="fs12 c-red" id="isSyncOn">ON表示可以使用用户填写的手机号及手机后六位登录前台；</small>
                                                            <small class="fs12 c-red hide" id="isSyncOff">OFF表示需自行注册前台账号</small>
                                                        </span>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div th:if="${sysUser['id']}==null or  ${sysUser['id']} <= 0" class="hr-line-dashed"></div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label text-right">管理员头像</label>
                                            <div class="col-sm-10">
                                                <p>
                                                    <button class="btn btn-primary " type="button" id="sysUserImage">
                                                        <i class="fa fa-image"></i>&nbsp;上传头像
                                                    </button>
                                                </p>
                                                <div class="clearfix" id="coverImage">
                                                    <div class="file-box">
                                                        <div class="file">
                                                            <span class="corner" title="删除" id="remove-image"><i class="fa fa-remove"></i></span>
                                                            <div class="image">
                                                                <img alt="管理员头像" id="material-image" class="img-responsive" th:src="!${#maps.isEmpty(sysUser['imageMap'])} ? ${sysUser['imageMap']['pcUrlMap']['large']} : @{{path}/admin/v3/img/default/default-pic.jpg?v={v}(path=${staticPath},v=${v})}"/>
                                                            </div>
                                                            <div class="file-name">
                                                                <p id="file-names" th:text="!${#maps.isEmpty(sysUser['imageMap'])} and ${sysUser['imageMap']['fileName']}!=null ? ${sysUser['imageMap']['fileName']}:'文件名'"></p>
                                                                <small id="create-time" th:text="!${#maps.isEmpty(sysUser['imageMap'])} and ${sysUser['imageMap']['createTime']}!=null ? ${sysUser['imageMap']['createTime']}:'上传时间'"></small>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="hr-line-dashed"></div>

                                        <div class="form-group">
                                            <div class="col-sm-6 col-sm-offset-2">
                                                <button th:if="${sysUser['id']}==null or ${sysUser['id']} <= 0" class="btn btn-primary" type="button" id="saveAndContinue">保存，继续创建</button>
                                                <button class="btn btn-primary ml10" type="button" id="saveAndReturn">保存，返回</button>
                                                <button class="btn btn-white ml10" type="button" id="saveCancel">取消</button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div data-th-replace="common/importantNotes"></div>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <div data-th-replace="layout/head-footer"></div>
    <script type="text/javascript" th:src="@{{path}/admin/business/manage/group/commom-group-win.js?v={v}(path=${staticPath},v=${v})}"></script>
    <script type="text/javascript" th:src="@{{path}/admin/business/upload/common-webuploader.js?v={v}(path=${staticPath},v=${v})}"></script>
    <script type="text/javascript" th:src="@{{path}/admin/business/manage/user/save_sys_user.js?v={v}(path=${staticPath},v=${v})}"></script>
</body>
</html>